import './index.scss';
import React, { FC } from 'react';
import _ from 'lodash';
import { Link } from 'react-router-dom';

interface IProps{
  btnTitle: string;
  path?: string;
  handleClick?: () => void;
}

const Button: FC<IProps> = ({
  btnTitle,
  path,
  handleClick
}) => {
  return (
    <div className="confirm-btn">
      {
        handleClick
        ? 
        <div
          className="btn"
          onClick={_.debounce(handleClick, 300)}>{btnTitle}
        </div>
        :
        <Link to={ path!} className="btn">{ btnTitle} </Link>
      }
    </div>
  );
}

export default Button;



